<extend name="./public/frame.html"/>
<block name="content">
    <div class="layer_content">
        <div class="layer_form">
            <div class="down_icon"></div>
            <div class="layer_div">
                <div class="layer_tit">
                    旧手机号：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180" id="old_phone" placeholder="手机号搜索（old）">
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    新手机号：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180" id="new_phone" placeholder="手机号搜索（new）">
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    开始时间：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180" id="start" placeholder="开始时间（申请）">
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    结束时间：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180" id="end" placeholder="结束时间（申请）">
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    审核状态：
                </div>
                <div class="layer_control">
                    <select id="phone_check_result" class="w180">
                        <option value="">审核结果</option>
                        <option value="0">审核中</option>
                        <option value="1">已拒绝</option>
                        <option value="2">已通过</option>
                    </select>
                </div>
            </div>
            <div class="button_search">
                <button class="layui-btn" data-type="search">搜索</button>
            </div>
        </div>
    </div>

    <table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('User/alterPhone')}', page: true, limit: 10, id:'test'}" lay-filter="test">
        <thead>
        <tr>
            <th lay-data="{field:'uid', width:80, fixed: true, sort: true, align:'center'}">UID</th>
            <th lay-data="{field:'old_phone', width:180, align:'center'}">原手机号</th>
            <th lay-data="{field:'new_phone', width:180, align:'center'}">新手机号</th>
            <th lay-data="{field:'user_type', width:120, align:'center'}">用户角色</th>
            <th lay-data="{field:'phone_time', width:150, align:'center'}">申请时间</th>
            <th lay-data="{field:'phone_reason', width:160, align:'center'}">申请理由</th>
            <th lay-data="{field:'checkResult', width:180, align:'center'}">审核结果</th>
            <th lay-data="{field:'phone_check_person', width:100, align:'center'}">审核人</th>
            <th lay-data="{field:'phone_check_time', width:150, align:'center'}">审核时间</th>
            <th lay-data="{fixed:'right', toolbar: '#barDemo', width:100, align:'center'}">操作</th>
        </tr>
        </thead>
    </table>
    <script type="text/html" id="barDemo">
        <a lay-event="look">查看</a>
    </script>
    <script>
        layui.use(['table','laydate'], function () {
            var table = layui.table,laydate = layui.laydate;
            laydate.render({
                elem: '#start'      //指定元素
                , type: 'datetime'
                ,theme: '#393D49'
            });
            laydate.render({
                elem: '#end'        //指定元素
                ,type: 'datetime'
                ,theme: '#393D49'
            });
            //监听工具条
            table.on('tool(test)', function (obj) {
                var data = obj.data;
                var layEvent = obj.event;
                var id = data.id;
                if (layEvent === 'look') {
                    layer.open({
                        type: 2,
                        title: '号码审核',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['90%', '90%'],
                        content: '{:url("/admin/user/look","id=")}' + id //iframe的url
                    });
                }
            });
            //搜索
            $('.layui-btn').on('click', function () {
                var old_phone   = $("#old_phone").val();
                var new_phone   = $("#new_phone").val();
                var start       = $("#start").val();
                var end         = $("#end").val();
                var phone_check_result = $("#phone_check_result").val();
                var is_fr = $("#is_fr").val();
                table.reload('test', {
                    url: '/admin/User/alterPhone/', where: {
                        "old_phone": old_phone,
                        "new_phone": new_phone,
                        "start": start,
                        "end": end,
                        "phone_check_result":phone_check_result,
                        "is_fr":is_fr,
                    }
                });
            })
        });
    </script>
</block>
